#ifndef SCAN_H
#define SCAN_H
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <mutex>
#include <thread>
#include "help.h"

extern std::mutex open_ports_mutex;
extern std::mutex closed_ports_mutex;
extern std::mutex filtered_ports_mutex;
extern std::mutex closed_filtered_ports_mutex;
extern std::mutex open_filtered_ports_mutex;

extern std::vector<PortInfo> open_ports;
extern std::vector<PortInfo> closed_ports;
extern std::vector<PortInfo> filtered_ports;
extern std::vector<PortInfo> closed_filtered_ports;
extern std::vector<PortInfo> open_filtered_ports;


class portScan {
public:
	portScan(int startPort,int endPort,char* ip,char* mode);
	
    void run();
	void receive(int port);
    void sendPacket(int port);

private:
	int startPort;
	int endPort;

    char* mode;
	char* ip;

    char* localIp;
};

void scanPorts(int startPort, int endPort, char* ip, char* mode);

void allotThread(int startPort, int endPort, char*portScanMode,int threadCount,char* ip);
#endif // SCAN_H